load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")

package(
    default_visibility = ["//visibility:public"],
    licenses = ["notice"],
)

py_library(
    name = "scann",
    tags = ["local"],
    deps = [
        ":scann_builder",
        ":scann_ops",
        ":scann_ops_pybind",
    ],
)

py_library(
    name = "scann_builder",
    srcs = ["scann_builder.py"],
    tags = ["local"],
    deps = [],
)

py_library(
    name = "scann_ops",
    srcs = [
        "scann_ops.py",
    ],
    data = [
        "//scann/scann_ops/cc:_scann_ops.so",
    ],
    tags = ["local"],
    deps = [
        ":scann_builder",
    ],
)

py_test(
    name = "scann_ops_test",
    size = "medium",
    srcs = ["scann_ops_test.py"],
    python_version = "PY3",
    shard_count = 4,
    tags = ["local"],
    deps = [
        ":scann_ops",
    ],
)

py_library(
    name = "scann_ops_pybind",
    srcs = ["scann_ops_pybind.py"],
    data = [
        "//scann/scann_ops/cc/python:scann_pybind.so",
    ],
    tags = ["local"],
    deps = [
        ":scann_builder",
        ":scann_ops_pybind_backcompat",
    ],
)

py_test(
    name = "scann_ops_pybind_test",
    size = "medium",
    srcs = ["scann_ops_pybind_test.py"],
    python_version = "PY3",
    shard_count = 8,
    tags = ["local"],
    deps = [
        ":scann_ops_pybind",
    ],
)

py_library(
    name = "scann_ops_pybind_backcompat",
    srcs = ["scann_ops_pybind_backcompat.py"],
    tags = ["local"],
    deps = [
        "//scann/scann_ops:scann_assets_py_pb2",
    ],
)
